﻿@using System.Collections.Generic
@using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Authentication
@model SF.Web.SimpleAuth.ViewModels.LoginViewModel

@if (!string.IsNullOrEmpty(Model.RecaptchaSiteKey))
{
    <script src='https://www.google.com/recaptcha/api.js'></script>
}

@{
    ViewData["Title"] = "Log in";
}

<h2>@ViewData["Title"].</h2>
<div class="row">
    <div class="col-md-12">
        <section>
            <form asp-controller="Login" asp-action="Index" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form">
                <div asp-validation-summary="All" class="text-danger"></div>
                <div class="form-group">
                    <label asp-for="UserName" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <input asp-for="UserName" class="form-control" />
                        <span asp-validation-for="UserName" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label asp-for="Password" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <input asp-for="Password" class="form-control" />
                        <span asp-validation-for="Password" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <div class="checkbox">
                            <input asp-for="RememberMe" />
                            <label asp-for="RememberMe"></label>
                        </div>
                    </div>
                </div>
                @if (Model.RecaptchaSiteKey.Length > 0)
                {
                    <div class="form-group">
                        <div class="col-md-offset-2 col-md-10">
                            <div class="g-recaptcha" data-sitekey="@Model.RecaptchaSiteKey"></div>
                            @Html.ValidationMessage("recaptchaerror", new { @class = "text-danger" })
                        </div>
                    </div>

                }
                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <button type="submit" class="btn btn-default">Log in</button>
                    </div>
                </div>
                
            </form>
        </section>
    </div>
</div>

@section Scripts {
    @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
